package heartbeat

import "github.com/prometheus/client_golang/prometheus"

const (
	namespace = `agent`
)

type metricInfo struct {
	Desc *prometheus.Desc
	Type prometheus.ValueType
}

func newTestMetricInfo() metricInfo {
	return metricInfo{
		Desc: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, `heartbeat`, `host`),
			`nothing to help`,
			[]string{`agent`, `heartbeat`},
			nil,
		),
		Type: prometheus.CounterValue,
	}
}

type HeartBeatExporter struct {
	counter prometheus.Counter
}

func NewHeartBeatExporter() *HeartBeatExporter {
	return &HeartBeatExporter{counter: prometheus.NewCounter(prometheus.CounterOpts{
		Namespace: namespace,
		Name:      "exporter_csv_parse_failures_total",
		Help:      "Number of errors while parsing CSV.",
	})}
}

func (e *HeartBeatExporter) Describe(ch chan<- *prometheus.Desc) {
	// ch <- newTestMetricInfo().Desc
	ch <- e.counter.Desc()
}

func (e *HeartBeatExporter) Collect(ch chan<- prometheus.Metric) {
	e.counter.Add(1)

	ch <- e.counter
}
